package entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 朱颢阳
 * @description
 * @time 2024/8/6 19:26
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private Integer code;
    private String msg;
    private Object object;

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(Integer code, Object object) {
        this.code = code;
        this.object = object;
    }

    public Result(Integer code) {
        this.code = code;
    }

    public static Result success(String msg, Object object){
        return new Result(200,msg,object);
    }
    public static Result success(){
        return new Result(200);
    }
    public static Result success(String msg){
        return new Result(200,msg);
    }
    public static Result success(Integer code, Object object){
        return new Result(code,object);
    }

    public static Result failed(Integer code,String msg){
        return new Result(code,msg,null);
    }
}
